function [ ] = MakeLab5Report(fx, a, b, eps, fileName)
a = double(sym(a));
b = double(sym(b));
fileId = fopen(fileName, 'w');
fprintf(fileId, '------------- Lab 5 Report --------------\n\n');
fprintf(fileId, 'f(x) = %s]\n', fx);
fprintf(fileId, 'The function has %d roots on [%.2f ; %.2f]\n\n', ShturmTheorem(fx, a, b), a, b);

fprintf(fileId, 'Searching roots: \n\n');
step = double((sym(b) - sym(a)) / 5);
while (step > 0.05)
    fprintf(fileId, '============================================\n');
    fprintf(fileId, '\t\tUsing searching step %.2f\n', step);
    fprintf(fileId, '============================================\n\n');
    intervals = DivideRoots(fx, a, b, step);
    for i = 1 : size(intervals, 1)
        [smRoot, smK, smU, smC] = SecantMethod(fx, intervals(i, 1), intervals(i, 2), eps);
        [nmRoot, nmK, nmU, nmC] = NewtonMethod(fx, intervals(i, 1), intervals(i, 2), eps);
        fprintf(fileId, 'Interval: [%.2f ; %.2f]\n', intervals(i, 1),  intervals(i, 2));
        fprintf(fileId, '----------------------------------------------\n\n');
        fprintf(fileId, 'Secant method:\n');
        if (smC == false)
            fprintf(fileId, 'No convergence\n');
        else
            fprintf(fileId, 'x%d = %.4f\n', i, smRoot);
            fprintf(fileId, 'Iterations: %d\n', smK);
            fprintf(fileId, 'Closure: %e\n\n', smU);
        end;
        fprintf(fileId, 'Newton method:\n');
        if (nmC == false)
            fprintf(fileId, 'No convergence\n');
        else
            fprintf(fileId, 'x%d = %.4f\n', i, nmRoot);
            fprintf(fileId, 'Iterations: %d\n', nmK);
            fprintf(fileId, 'Closure: %e\n\n', nmU);
        end;
    end;
    step = step / 2;
end;

fclose(fileId);


end

